From 0a662e284ecc42cb7170c17ee5ae2592ae66dfa9 Mon Sep 17 00:00:00 2001 From: "ach61@labyrinth.cl.cam.ac.uk" Date: Thu, 15 Jul 2004 12:52:00 +0000 Subject: [PATCH] bitkeeper revision 1.1095 (40f67df01t5vX4nRXlk29L0xLlSunA) use .gdbinit for setup --- docs/HOWTOs/XenDebugger-HOWTO | 31 +++++++++++++++++++++++++++++++ xen/arch/x86/pdb-stub.c | 8 ++++---- xen/common/debug-linux.c | 17 +++++++++-------- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/docs/HOWTOs/XenDebugger-HOWTO b/docs/HOWTOs/XenDebugger-HOWTO index 1aba294abb..a8574baa3e 100644 --- a/docs/HOWTOs/XenDebugger-HOWTO +++ b/docs/HOWTOs/XenDebugger-HOWTO @@ -264,10 +264,41 @@ processes, pdb currently supports just Linux 2.4. $4 = 27 +Some Helpful .gdbinit Commands +------------------------------ + +define setup + file .../install/boot/xen-syms + add-sym .../install/boot/vmlinux-syms-2.4.26-xen0 + add-sym /homes/aho/a.out +end +document setup + load symbols for xen, xenolinux (dom 0), and "a.out" +end + +define setup-linux + set pdb_pidhash_addr = &pidhash + set pdb_init_task_union_addr = &init_task_union + + set task_struct_mm_offset = (void *)&(init_task_union.task.mm) - (void *)&(init_task_union.task) + set task_struct_next_task_offset = (void *)&(init_task_union.task.next_task) - (void *)&(init_task_union.task) + set task_struct_pid_offset = (void *)&(init_task_union.task.pid) - (void *)&(init_task_union.task) + set task_struct_pidhash_next_offset = (void *)&(init_task_union.task.pidhash_next) - (void *)&(init_task_union.task) + set task_struct_comm_offset = (void *)&(init_task_union.task.comm) - (void *)&(init_task_union.task) + set task_struct_comm_length = sizeof (init_task_union.task.comm) + + set mm_struct_pgd_offset = sizeof (struct vm_area_struct *) * 2 + sizeof (rb_root_t) +end +document setup-linux + define various xenolinux specific offsets and sizes in pdb +end + + Changes ------- +04.07.15 aho .gdbinit 04.02.05 aho creation 04.03.31 aho add description on debugging multiple domains diff --git a/xen/arch/x86/pdb-stub.c b/xen/arch/x86/pdb-stub.c index 532db8eb14..51cb898dc5 100644 --- a/xen/arch/x86/pdb-stub.c +++ b/xen/arch/x86/pdb-stub.c @@ -22,7 +22,7 @@ #include #include -#undef PDB_DEBUG_TRACE +#define PDB_DEBUG_TRACE #ifdef PDB_DEBUG_TRACE #define TRC(_x) _x #else @@ -971,9 +971,9 @@ int pdb_change_values(u_char *buffer, int length, int pdb_change_values_one_page(u_char *buffer, int length, unsigned long cr3, unsigned long addr, int rw) { - l2_pgentry_t* l2_table = NULL; - l1_pgentry_t* l1_table = NULL; - u_char *page; + l2_pgentry_t* l2_table = NULL; /* page directory */ + l1_pgentry_t* l1_table = NULL; /* page table */ + u_char *page; /* 4k page */ int bytes = 0; l2_table = map_domain_mem(cr3); diff --git a/xen/common/debug-linux.c b/xen/common/debug-linux.c index ff767b51cd..557997be3f 100644 --- a/xen/common/debug-linux.c +++ b/xen/common/debug-linux.c @@ -55,14 +55,15 @@ static inline unsigned long machine_to_phys(unsigned long cr3, unsigned long pdb_pidhash_addr = 0xc01971e0UL; unsigned long pdb_init_task_union_addr = 0xc0182000UL; -#define task_struct_mm_offset 0x2c -#define task_struct_next_task_offset 0x48 -#define task_struct_pid_offset 0x7c -#define task_struct_pidhash_next_offset 0xb0 -#define task_struct_comm_offset 0x23e -#define task_struct_comm_length 0x10 - -#define mm_struct_pgd_offset 0x0c + +unsigned int task_struct_mm_offset = 0x2c; +unsigned int task_struct_next_task_offset = 0x48; +unsigned int task_struct_pid_offset = 0x7c; +unsigned int task_struct_pidhash_next_offset = 0xb0; +unsigned int task_struct_comm_offset = 0x23e; +unsigned int task_struct_comm_length = 0x10; + +unsigned int mm_struct_pgd_offset = 0x0c; /* * find the task structure of a process (pid) -- 2.30.2